-
Notifications
You must be signed in to change notification settings - Fork 1.3k
plugin: Add new onBufferOptionChanged callback
#2962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
runtime/plugins/linter/linter.lua
Outdated
|
|
||
| makeLinter("gcc", "c", "gcc", {"-fsyntax-only", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") | ||
| makeLinter("g++", "c++", "gcc", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") | ||
| makeLinter("g++", "c++", "g++", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: this change might be unnecessary (though will not hurt either), since it's basically the same compiler.
BTW... it might be a good idea to remove the -std=c++14 param, to support newer versions of the standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the forced standard is a good idea, to go with the actual GCC defined defaults.
Regarding the invoked checker/compiler I had different experiences, due to the different defaults applied by gcc vs g++. Exactly this was the reason why we receive unexpected linter messages when saving a C++ file. So I really recommend to go with the explicit GNU C++ compiler for C++ files.
feeda28 to
85bb039
Compare
85bb039 to
33244e4
Compare
33244e4 to
85e2db0
Compare
85e2db0 to
11dfbf9
Compare
internal/buffer/settings.go
Outdated
| b.OptionCallback(option, nativeValue) | ||
| } | ||
|
|
||
| _, err := config.RunPluginFnBool(b.Settings, "onBufferOptionChanged", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the boolean result is ignored it doesn't seem to be necessary, except the other small difference that RunPluginFnBool() checks for buffer local settings[p.Name] being unset, which RunPluginFn() doesn't. Therefore with RunPluginFnBool() the callback isn't called in plugins which are disabled after loading, while with RunPluginFn() it is...which is an inconsistency on his own.
11dfbf9 to
dcf064a
Compare
This can become handy in the moment a plugin needs to react on e.g. changed file type.
dcf064a to
d1f54ea
Compare
With the introduction of the new callback it's possible for plugins to react upon changed buffer settings.
Especially the
linterplugin will benefit by this change, since it can the properly unregister messages created with a different linter type.Fixes #2961
Fixes #3587